using System;
using System.Data;
using digit.Core;

namespace SMS.ServiceManager
{
	public class CityData
	{
		#region CONSTRUCTORS
		public CityData( string connectionString)
		{
			this.m_connectionString = connectionString;
		}
		#endregion
		
		#region ATTRIBUTES
        const string SQL_INSERT = "vn1102_Insert_ City";
        const string SQL_UPDATE = "vn1102_Update_ City";
        const string SQL_DELETE = "vn1102_Delete_ City";
        const string SQL_SELECTONE = "vn1102_Select_ City";
        const string SQL_SELECTALL = "vn1102_SelectAll_ City";
        const string SQL_SEARCH = "vn1102_Search_ City";
		private string m_connectionString;
		#endregion
		
		#region METHODS
		public bool Insert( object[] values)
		{
			int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_INSERT, values);
			return i > 0;
		}
		
		public bool Update( object[] values)
		{
			int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_UPDATE, values);
			return i > 0;
		}
		
		public bool Delete( object[] values)
		{
			int i = DataAccess.ExecuteStoreProcedure(this.m_connectionString, SQL_DELETE, values);
			return i > 0;
		}
		
		public DataTable Select( object[] values)
		{
			return DataAccess.FillTable(this.m_connectionString, SQL_SELECTONE, values, true);
		}
		
		public DataTable SelectAll()
		{
			return DataAccess.FillTable(this.m_connectionString, SQL_SELECTALL, true);
		}
		
		public DataTable Search( object[] values,  int startIndex,  int maxRow)
		{
			return DataAccess.FillTableSpecial(this.m_connectionString, SQL_SEARCH, values, true, startIndex, maxRow, "City");
		}
		
		#endregion
		
	}
}